File: /home/shaping-sar.ru/public_html/function.php
<?php
function scanInPhp($dir, $search) {
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
foreach ($rii as $file) {
if ($file->isDir()) continue;
if (strtolower($file->getExtension()) !== 'php') continue;
if (strtolower($file->getFilename()) === 'test.php') continue;
$lines = file($file->getPathname());
foreach ($lines as $num => $line) {
if (stripos($line, $search) !== false) {
echo "Файл: " . $file->getPathname() . " | Строка " . ($num + 1) . ": " . trim($line) . "<br>";
}
}
}
}